#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkConeSource.h>
#include <vtkSphereSource.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include<vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkArrowSource.h>
#include<vtkRegularPolygonSource.h>
#include<vtkPlaneSource.h>


int main(int argc, char *argv[])
{
   vtkNew<vtkNamedColors>colors;

//    vtkNew<vtkConeSource>cone;
//    cone->SetHeight(3.0);
//    cone->SetRadius(1.0);
//    cone->SetResolution(10);
    // vtkNew<vtkArrowSource>cone;
    // cone->SetShaftRadius(1.0);+
    // cone->SetTipLength(1.5);
    // vtkNew<vtkRegularPolygonSource> cone;

    // cone->GeneratePolylineOff();
    // cone->SetNumberOfSides(50);
    // cone->SetRadius(5);
    // cone->SetCenter(0,0,0);
    // cone->Update();
    vtkNew<vtkPlaneSource>cone;
    cone->SetCenter(2.0,0,0);
    cone->SetNormal(1.0,0.0,1.0);
    
//创建映射器，将上面创建的数据映射为几何数据的格式
//vtkPolyData是一种常见的数据源，由点线面组成，vtkPolyData可以用来表示各种几何图形
   vtkNew<vtkPolyDataMapper> coneMapper;
   coneMapper->SetInputConnection(cone->GetOutputPort());
//创建actor，任何可视化的数据都要绑定actor
   vtkNew<vtkActor> coneActor;
   coneActor->SetMapper(coneMapper);
   double pos[3] = {15.0,2.0,3.0};
   coneActor->SetPosition(pos);
   coneActor->GetProperty()->SetColor(colors->GetColor3d("Red").GetData());
//创建渲染器
   vtkNew<vtkRenderer>ren1;
   ren1->AddActor(coneActor);
   ren1->SetBackground(colors->GetColor3d("MidnightBlue").GetData());
   // ren1->SetBackground(1.0,1.0,1.0);

//创建渲染窗口
   vtkNew<vtkRenderWindow>renWin;
   renWin->AddRenderer(ren1);
   renWin->SetSize(600,500);
   renWin->SetWindowName("Cone");

//创建交互窗口
    vtkNew<vtkRenderWindowInteractor>iren;
    iren->SetRenderWindow(renWin);

    iren->Initialize();

    renWin->Render();
    iren->Start();
   return EXIT_SUCCESS;
  
}